package com.inossem.warehousestorage_inossem.request.allocation;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.allocation.AllocationDocumentsBean;
import com.inossem.warehousestorage_inossem.bean.refundStorage.RefundStoragePickingListBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * 调拨单据列表
 *
 * @author 詹建宇
 * @time on 2018/3/29 16:33
 * @email jianyu.zhan@inossem.com
 */
public class AllocationDocumentsRequest extends Request {
    private static final String CONDITION = "condition";//调拨单号

    public static String request(Context context, String condition, GsonBeanListener gsonBeanListener) {
        String tag;
        Map<String, String> params = new HashMap<>();
        params.put(CONDITION, condition);
        String url = RequestManage.getUrl(context, RequestConstant.URL_ALLOCATION_OUT_DOCUMENT_LIST + RequestManage.mapEncodeToParams(params));
        tag = RequestManage.getHttpsGetWithLoading(context, url, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                AllocationDocumentsBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), AllocationDocumentsBean.class);
                excuteJsonBeanNew(context, bean,gsonBeanListener);
            }
        });
        return tag;
    }
}
